//
//  ViewController.swift
//  PicturesLooper
//
//  Created by 范伟 on 16/3/13.
//  Copyright © 2016年 FanWei. All rights reserved.
//

import UIKit
import SnapKit

class ViewController: UIViewController {
    
    private lazy var imagePaths: [String] = { () -> [String] in
        var paths = [String]()
        for i in 1...5 {
            var path = String(format: "%d.jpg", i)
            path = NSBundle.mainBundle().pathForResource(path, ofType: nil)!
            paths.append(path)
        }
        return paths
    }()

    override func viewDidLoad() {
        super.viewDidLoad()
        let loopView = FWLoopView(imagePaths: imagePaths) { (index) -> Void in
            print("选中了\(index)✌️")
        }
        view.addSubview(loopView)

        loopView.snp_makeConstraints { (make) -> Void in
            make.left.equalTo(view).offset(20)
            make.right.equalTo(view).offset(-20)
            make.top.equalTo(view).offset(20)
            make.bottom.equalTo(view).offset(-100)
        }
    }
}

